package io.itit.ecp.admin.common.enums;

import io.itit.grass.common.enums.IBaseEnum;

import java.io.Serializable;

/**
 * <p>
 *
 * @Author：Roy
 * @Description：能源类型
 * @Date：Create by 2023-11-23 16:12:43
 */
public interface IEnergyTypeEnums {

    /* 状态(1:启用,2:禁用) */
    enum Status implements IBaseEnum {
        status1(1, "启用"),
        status2(2, "禁用");

        public final Integer status;
        public final String desc;

        Status(Integer status, String desc) {
            this.status = status;
            this.desc = desc;
        }

        @Override
        public Serializable getValue() {
            return status;
        }

        @Override
        public String getDesc() {
            return desc;
        }
    }

    /* 类型(1:启用,2:禁用) */
    enum Type implements IBaseEnum {
        cold("cold", "冷", "m³", "kgCO2/m³"),
        water("water", "水", "t", "kgCO2/t"),
        electric("electric", "电", "kWh", "kgCO2/kWh");

        public final String type;
        public final String desc;
        public final String unit;
        public final String factorUnit;

        Type(String type, String desc, String unit, String factorUnit) {
            this.type = type;
            this.desc = desc;
            this.unit = unit;
            this.factorUnit = factorUnit;
        }

        public static String getUnit(String type) {
            for (Type t : Type.values()) {
                if (t.type.equals(type)) {
                    return t.unit;
                }
            }
            return null;
        }

        public static String getFactorUnit(String type) {
            for (Type t : Type.values()) {
                if (t.type.equals(type)) {
                    return t.factorUnit;
                }
            }
            return null;
        }

        @Override
        public Serializable getValue() {
            return type;
        }

        @Override
        public String getDesc() {
            return desc;
        }

        public String getUnit() {
            return unit;
        }

        public String getFactorUnit() {
            return factorUnit;
        }

        public String getType() {
            return type;
        }
    }

}
